var levelOrderBottom = function(root) {
    var queue = [];
    var result = [];
    if(root) queue.push(root);
    while(queue.length){
        var arr = [];
        var len = queue.length
        for(var i=0; i<len; i++){
            var curNode = queue.shift();
            arr.push(curNode.val);
            if(curNode.left) queue.push(curNode.left);
            if(curNode.right) queue.push(curNode.right);
        }
        result.unshift(arr);
    }
    return result;
};